It is an object of a database system to allow many users to use the same information at the same time, while making it seem that each user has exclusive access to all information. The database system should provide this service with minimal loss of performance (latency) and maximal transaction throughput. The service is generally provided by so-called concurrency control mechanisms which are responsible for coordinating conflicting access to shared resources, ensuring serial ordering and preventing deadlocks and reducing communication and other overhead required to achieve these ends. Concurrency control is complicated by the fact that the information content of a database typically evolves over time. New information may be inserted into the database and existing information may be updated, and information may eventually deleted. Single-version databases record only the latest, most recent state of the information. If information is inserted into a single-version database at one time, and is subsequently modified, the single-version database will record only the modified state of the information. Once information is deleted from a single-version database, the deleted information is no longer accessible.
While the content of single-version databases may be modified, Single-Version Database Management Systems (DBMS) prevent modifications from being observed outside of the scope of the transaction that made the changes. This ensures that at any given time, concurrent users of single-version databases will always “see” the same information in the same state. To control concurrent access to information in this manner, modifications must be delayed until no other user or application is looking at the information to be changed.
Access to information that is in the process of being modified is typically delayed through the use of “locking” mechanisms. Acquiring a lock gives the transaction permission to use a resource in a given way, for a given period of time. If a transaction cannot acquire a lock, it must wait, or give up. In general, two transactions can both acquire read locks on a given record, but cannot both acquire write locks on the same record.
Like single-version databases, multi-version databases also record the latest, most recent state of their information. In addition, they may record other states of their information content. These other states may include previous historical versions, possible future versions, or alternative current versions of the same information. If information is inserted into a multi-version database at one time, and is subsequently modified, the multi-version database may record both the original and the modified version of the information. Even if information is deleted from a multi-version database, previous historical versions of the information may still be present and accessible.
At any given time, concurrent users of multi-version databases may therefore “see” different versions of the same information. When a user modifies the content of a multi-version database, the multi-version DBMS creates a new version of the content while preserving the original content. When other users concurrently request access to the content, the multi-version DBMS is then able to present them with the original, unmodified version. Where a single-version DBMS controls concurrency by delaying conflicting access, a multi-version DBMS controls concurrency by controlling “visibility”, making different versions visible to different users at different times.
Thus, in the multi-version DBMS, fewer delays are required for controlling concurrency, less time and memory is required for “locking”, and users can even access potential states, asking questions “as of” a certain time. Also, multi-level security schemes are easier to build on top of databases, and mistaken changes are more easily identified and rectified.
However, a multi-version DBMS requires significantly more persistent storage capacity (e.g. disk storage capacity), and presents challenges in efficiently selecting the appropriate version for a given request.